*This master file replicates the paper in the Statistics Finland FIONA remote system using proprietary administrative data. Please upload the replication package to the remote system to run this file. Please refer to the README file for instructions on accessing the proprietary administrative data.


*Working directory path here
cd ""

*Path to where the replication package is uploaded
global path ""

*Path where output and temporary files will be stored
global temp ""


/////////
*Analysis
/////////

*Create local-level shift-share variables
do "$path\Code\create_shift_share.do"

*Join controls. Create local-level balance table 5.
do "$path\Code\balance_table.do"

*Defines further exposure variables used in the individual and local level analysis.  
do "$path\Code\shift_share_shocks.do"

*Create income ranks used in the analysis as well as the parent links for the upward mobility analysis. 
do "$path\Code\create_1970_1975_data.do"

*Run the occupational and education analysis. And the Upward mobility analysis. Creates Tables 9 and 11.
do "$path\Code\education_UM_analysis.do"
*(robust_old_young.do and robustness_UM.do and young_treat_dd_occu and young_treat_dd.do files run in the file). Creates Figure A.3., and Tables A.3, D.11 and D.12.  

*Examine further heterogeniety in the sample. Creates panels of Table D.21.
do "$path\Code\hetero_old_young_dd.do"

*Run the sector and income results for established workers. Creates Table 8.
do "$path\Code\established_workers.do"
*(robustness_1970_run.do + robustness_1950_run.do run in the file) Creates Tables D.10.

*Make descriptive age of graduation pics with histograms Figure A.4.
do "$path\Code\descriptive_graduation_ages" 

*Local-level industry structure analysis

*create input-output municipality Leontief measures and capital and human capital intensity 1939
do "$path\Code\create_downstream_upstream_bartik.do"
do "$path\Code\create_1939_capital_hc.do"

*Create dowstream and upstream industry-level 1970 outcomes 
do "$path\Code\industry_input_output_1970.do"

*run the municipality level upstream downstreal capital intensit and human capital intensity estimations. Creates table A.6
do "$path\Code\industry_structure_1970.do" 

*run the municipality level event study of graduation years. Creates Figure A.5 and Table A.2.
do "$path\Code\municipality_graduation_event_study.do" 

*run the municipality level estimation of education institutes. Creates Table 10.
do "$path\Code\edu_institutes_estimation.do"

*Shift-share robustness Goldsmith-Pinkham et al. (2020). Table D.16
do "$path\Code\bartik_GSS_robust.do"

*Shift-share robustness Borusyak et al. (2022). Table D.17.
do "$path\Code\bartik_BHJ_robustness.do"

*Shift-share robustness Adao et al. (2019). Table  D.17.
do "$path\Code\clean_data_adao.do"
do "$path\Code\adao_bartik_cis.do"

*Shift-share robustness Borusyak and Hull (2024). Table  D.18.
do "$path\Code\gen_permutated_shocks.do" 
do "$path\Code\BH_exo_robust.do"

